cmake_minimum_required(VERSION 3.14)

project(testplugin LANGUAGES CXX)

set(CMAKE_AUTOUIC ON)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

set(CMAKE_LIBRARY_OUTPUT_DIRECTORY {CMAKE_CURRENT_BINARY_DIR}/lib)

find_package(QT NAMES Qt6 Qt5 REQUIRED COMPONENTS Widgets Gui Core)
find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Widgets Gui Core)

include_directories(${CMAKE_SOURCE_DIR}/utkcore)
include_directories(${CMAKE_SOURCE_DIR}/utkwidget)

add_library(testplugin SHARED
  genericplugin.cpp
  genericplugin.h
  testplugin.json
)

target_link_libraries(testplugin PRIVATE Qt${QT_VERSION_MAJOR}::Gui Qt${QT_VERSION_MAJOR}::Widgets
    Qt${QT_VERSION_MAJOR}::Core utkwidget utkcore)

target_compile_definitions(testplugin PRIVATE TESTPLUGIN_LIBRARY)
